import DB

def test_inserts():
    for i in range(0,10):
        pid = int(input("请输入id(int)："))
        username = input("请输入姓名(varchar)：")
        age = int(input("请输入年龄(int)："))
        sex = input("请输入性别(char)：")
        high = float(input("请输入身高(1位整数2位小数点)："))
        value = (pid,username,age,sex,high)
        sql = "insert into person values {}".format(value)
        DB.update(sql)


def test_insert():
    pid = int(input("请输入id(int)："))
    username = input("请输入姓名(varchar)：")
    age = int(input("请输入年龄(int)："))
    sex = input("请输入性别(char)：")
    high = float(input("请输入身高(1位整数2位小数点)："))
    value = (pid,username,age,sex,high)
    sql = "insert into person values {}".format(value)
    DB.update(sql)


def test_delete():
    sql = "delete from person where pid = %s"
    param = (int(input("请输入id(int)：")))
    DB.update(sql,param)


def test_update():
    param = (input("请输入姓名(varchar)："), int(input("请输入id(int)：")))
    sql = "update person set username = %s where pid = %s"
    DB.update(sql,param)


def test_select():
    p_id = int(input("请输入id(int)："))
    sql = f"select * from person where pid = {p_id}"
    DB.select(sql)


# test_insert()
# test_insert()
# test_insert()
# test_delete()
# test_update()
# test_select()

test_inserts()

